﻿@model Enter.Mvc.Mall.Model.User.LogOnModel
@{
    ViewBag.Title = "登陆";
    Layout = "~/Views/Shared/_AccountLayout.cshtml";
}
@section Scripts
{
    <script type="text/javascript" src="../../Scripts/jquery/jquery-1.4.4.js"></script>
    <script type="text/javascript" src="../../Scripts/val.js"></script>
    <script>
        jQuery(function ($) {
            $("#getcheck").click(ValidateCode_onClick);
            ValidateCode_onClick();
        });
        function ValidateCode_onClick() {
            $("#imgvalid").attr("src", "/Common/GetValidateCode?length=4&ran=" + (new Date()).toString());
            $("#ValidateCode").val('');

        }
        function Check() {
           
            if ($("#UserName").val() == "") {
                $("#divMsg").html("请输入用户名");
                return false;
            }
            if ($("#Password").val() == "") {
                alert('');
                $("#divMsg").html("请输入密码");
                return false;
            }
            if ($("#ValidateCode").val() == "") {
                $("#divMsg").html("请输入验证码");
                return false;
            }
            return true;
        }
        function fromValidator() {
            if (Check()) {
                $.post("/User/LogOn", $("#logOnForm").serialize(), function (data) {
                    if (data.ResultCode == "00") {
                        window.location.href = "/Home/Index";
                    } else {
                        $("#divMsg").html(data.ResultMsg);
                        ValidateCode_onClick();
                      
                    }

                }, "json");
               
            }
         
        }
      
    </script>
}
<form id="logOnForm">
<div class="main pageWidth">
    <div class="memberloginmid clearself">
        <div class="midleft fl">
            <div class="logo1">
            </div>
        </div>
        <div class="midright fr">
            <div class="dis_leftborder fl">
            </div>
            <div class="dis_intr fl clearself">
                <ul class="tabs_title clearself">
                    <li><a href="#;">会员登录</a></li></ul>
                <div class="panes dis_tabs">
                    <div>
                        <table width="290" border="0" class="tb">
                            <tr>
                                <td width="67" align="right">
                                    用户名
                                </td>
                                <td colspan="2">
                                    <input type="text" id="UserName" name="UserName" class="text"  />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    密 码
                                </td>
                                <td colspan="2">
                                    <input type="text" id="Password" name="Password" class="text" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    验证码
                                </td>
                                <td width="85">
                                    <img id="imgvalid" src="../images/z_auth.gif">
                                </td>
                                <td width="124">
                                    <input id="ValidateCode" name="ValidateCode" style="width: 60px; font-size: 16px;" type="text"
                                        class="text">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="2">
                                    <a id="getcheck" class="changeauth" href="#">看不清,换一张</a>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <div id="divMsg" style="color: Red">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="2">@Html.ActionLink("忘记密码", "Register", new { }, new { style = " margin-top:8px;", @class = "forgetpassword fr" })<input
                                    name="" type="button" onclick="return fromValidator()" value="登录" class="btn" />
                                </td>
                            </tr>
                            <tr>
                                <td height="40">
                                    &nbsp;
                                </td>
                                <td colspan="2">@Html.ActionLink("免费注册", "Register", new { }, new { @class = "forgetpassword fr" })如果您还没有账号请
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            <div class="dis_rightborder fr">
            </div>
        </div>
    </div>
</div>
</form>
